package com.rn.ddd.infrastructure.engine;

import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;

import java.util.List;

@Component
public class PluginExecutor {

    public Result<?> parallelExecutor(List<PluginHandler> pluginHandlers, StateContext<?> context) throws Exception {
        if (!CollectionUtils.isEmpty(pluginHandlers)) {
            if (pluginHandlers.size() == 1) {
                return pluginHandlers.get(0).execute(context);
            }
        }
        return new Result<>(true);
    }
}
